/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Cubiculo")
@NamedQueries({
    @NamedQuery(name = "Cubiculo.findAll", query = "SELECT c FROM Cubiculo c"),
    @NamedQuery(name = "Cubiculo.findByIdCubiculo", query = "SELECT c FROM Cubiculo c WHERE c.idCubiculo = :idCubiculo"),
    @NamedQuery(name = "Cubiculo.findByNombre", query = "SELECT c FROM Cubiculo c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Cubiculo.findByAforo", query = "SELECT c FROM Cubiculo c WHERE c.aforo = :aforo"),
    @NamedQuery(name = "Cubiculo.findByEstado", query = "SELECT c FROM Cubiculo c WHERE c.estado = :estado")})
public class Cubiculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdCubiculo")
    private Integer idCubiculo;
    @Size(max = 30)
    @Column(name = "Nombre")
    private String nombre;
    @Column(name = "Aforo")
    private Integer aforo;
    @Column(name = "Estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCubiculo", fetch = FetchType.LAZY)
    private List<ReservaCubiculo> reservaCubiculoList;
    @JoinColumn(name = "IdZona", referencedColumnName = "IdZona")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Zona idZona;

    public Cubiculo() {
    }

    public Cubiculo(Integer idCubiculo) {
        this.idCubiculo = idCubiculo;
    }

    public Integer getIdCubiculo() {
        return idCubiculo;
    }

    public void setIdCubiculo(Integer idCubiculo) {
        this.idCubiculo = idCubiculo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getAforo() {
        return aforo;
    }

    public void setAforo(Integer aforo) {
        this.aforo = aforo;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public List<ReservaCubiculo> getReservaCubiculoList() {
        return reservaCubiculoList;
    }

    public void setReservaCubiculoList(List<ReservaCubiculo> reservaCubiculoList) {
        this.reservaCubiculoList = reservaCubiculoList;
    }

    public Zona getIdZona() {
        return idZona;
    }

    public void setIdZona(Zona idZona) {
        this.idZona = idZona;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCubiculo != null ? idCubiculo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cubiculo)) {
            return false;
        }
        Cubiculo other = (Cubiculo) object;
        if ((this.idCubiculo == null && other.idCubiculo != null) || (this.idCubiculo != null && !this.idCubiculo.equals(other.idCubiculo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.Cubiculo[ idCubiculo=" + idCubiculo + " ]";
    }
    
}
